﻿@model IEnumerable<InVision_Ticket.Models.CustomerViewModel>

@{
    ViewBag.Title = "Index";
}

<h2>Customers</h2>
@if (InVision_Ticket.Utilities.RoleCheck.IsAdministrator(User.Identity.Name))
{ 
    @Html.ActionLink("Customer Marketing CSV Download", "CustomerCSV")
}


@using (Html.BeginForm())
{
        <fieldset>
        <legend>Search</legend>
        <span>
            <label>Search:</label>
            <input type="text" id="SearchText" name="SearchText"/>&nbsp;
            <label>Created After:</label>
            <input type="date" id="StartDate" name="StartDate"/> &nbsp;
            <label>Created Before:</label>
            <input type="date" id="EndDate" name="EndDate"/>&nbsp;&nbsp;
            My Location Only:<input type="checkbox" name="SearchLocation" value="True" checked/>
            <input type="submit" id="submit" value="Search" />

            
       </span>
    </fieldset>
}
<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
@*        <th>
            CustomerID
        </th>*@
        <th>
            BusinessCustomer
        </th>
        @*<th>
            CustomerContactID
        </th>*@
		<th>
			Name
		</th>
@*        <th>
            FirstName
        </th>
        <th>
            LastName
        </th>*@
        <th>
            PhoneString
        </th>
        @*<th>
            Address1
        </th>
        <th>
            Address2
        </th>
        <th>
            City
        </th>
        <th>
            State
        </th>
        <th>
            Zip
        </th>*@
        <th>
            Email
        </th>
        <th>
            PromotionalEmail
        </th>
@*		<th>
            CustomerNotes
        </th>*@
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr>
@*        <td>
            @Html.DisplayFor(modelItem => item.CustomerID)
        </td>*@
        <td>
            @Html.DisplayFor(modelItem => item.BusinessCustomer)
        </td>
  @*      <td>
            @Html.DisplayFor(modelItem => item.CustomerContactID)
        </td>*@
@*        <td>
            @Html.DisplayFor(modelItem => item.FirstName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.LastName)
        </td>*@
		<td>
			@Html.DisplayFor(modelItem => item.CustomerName)
		</td>
        <td>
            @Html.DisplayFor(modelItem => item.PhoneString)
        </td>
     @*   <td>
            @Html.DisplayFor(modelItem => item.Address1)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Address2)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.City)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.State)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Zip)
        </td>*@
        <td>
            @Html.DisplayFor(modelItem => item.Email)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.PromotionalEmails)
        </td>
@*		 <td>
            @Html.DisplayFor(modelItem => item.CustomerNotes)
        </td>*@
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.CustomerContactID }) |
            @Html.ActionLink("Details", "Details", new { id = item.CustomerContactID }) |
            @Html.ActionLink("Tickets", "CustomerTickets", new { id = item.CustomerID })
        </td>
    </tr>
}

</table>
